home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 592 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Semantics of "new foo[0]"
  5. Date: 29 Feb 1996 16:00:40 GMT
  6. Organization: Comp Sci, University of Melbourne
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4h3ij3$nva@mulga.cs.mu.OZ.AU>
  9. References: <MGB.96Feb27175316@kronecker.mitre.org> <4h1up3$l69@engnews1.Eng.Sun.COM>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Content-Type: text
  12. X-Nntp-Posting-Host: munta.cs.mu.oz.au
  13. Content-Length: 1330
  14. X-Lines: 37
  15. Originator: clamage@taumet
  16.  
  17. clamage@Eng.sun.com (Steve Clamage) writes:
  18.  
  19. >mgb@kronecker.mitre.org (G. Mike Butler D054) writes:
  20. >>According to the ARM section 5.3.3:
  21. >>     "operator new() can be called with the argument
  22. >>      zero.  Repeated such calls return pointers to
  23. >>      distinct objects."  
  24. >     
  25. >>But when I execute the following:
  26. [...]
  27. >>      foo *p = new foo[0];
  28. >>      foo *q = new foo[0];
  29. [...]
  30. >>I get
  31. >>    0x338d8 0x338e8
  32. >
  33. >>While these are distinct pointers, the pointers refer to overlapping
  34. >>objects.
  35. >
  36. >No, they don't.
  37.  
  38. You're right, but there *is* a contraction in the draft standard.
  39.  
  40. 5.3.4[expr.new]/8 says "... the allocation function is called to allocate
  41. an array with no elements", but 8.3.4[dcl.array]/1 says "An object of
  42. array type contains a contiguously allocated non-empty set of N sub-objects".
  43.  
  44. I think that the adjective "non-empty" should be deleted from 8.3.4/8;
  45. it already states in 8.3.4/1 that array bounds in array type declarations
  46. must be greater than zero.
  47.  
  48. --
  49. Any mail to me between Feb 24th and 27th may have gone to the bit bucket
  50. (#&$^@$!# mail software silently ignored disk full error).  Please resend.
  51. (comp.std.c++ articles were not affected, so no need to resend those.)
  52. Fergus Henderson                 WWW: http://www.cs.mu.oz.au/~fjh
  53. fjh@cs.mu.oz.au                  PGP: finger fjh@128.250.37.3
  54.  
  55.  
  56. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your
  57.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  58.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  59.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  60.   Comments? mailto:std-c++-request@ncar.ucar.edu
  61. ]
  62.